﻿using Abp.AutoMapper;
using Paas.Core.Common.Entities;
using Basefr.App.Dtos;
using System.Collections.Generic;
using System.Linq;

namespace Paas.App.Interface.Common.Dtos
{
    [AutoMap(typeof(Announcement))]
    public class AnnouncementDto : DtoBase
    {
        public string Title { get; set; }

        public string Content { get; set; }

        public long PosterId { get; set; }
        public string PosterName { get; set; }

        public List<AnnouncementAttachDto> Attaches { get; set; }

        [AutoMap(typeof(AnnouncementAttach))]
        public class AnnouncementAttachDto
        {
            public int FileId { get; set; }
            public FileDto File { get; set; }
        }

        public List<FileDto> AttachFiles => Attaches?.Select(p => p.File).ToList();
    }
}

